<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:c="http://java.sun.com/jsp/jstl/core">
<f:view>
	<h:form id='stock_lines_form'>
		<h:head>
			<style type="text/css" title="currentStyle">
				@import "${facesContext.externalContext.requestContextPath}/resources/css/datatable/datatable_table.css";
				@import "${facesContext.externalContext.requestContextPath}/resources/css/datatable/TableTools.css";
				@import "${facesContext.externalContext.requestContextPath}/resources/css/datatable/TableTools_JUI.css";
			</style>
			<script type="text/javascript"
				src="${facesContext.externalContext.requestContextPath}/resources/script/jquery.js"></script>
				
			<script type="text/javascript"
				src="${facesContext.externalContext.requestContextPath}/resources/script/datatable/jquery.dataTables.js"></script>
			<script type="text/javascript"
				src="${facesContext.externalContext.requestContextPath}/resources/script/datatable/jquery.jeditable.js"></script>
			<script type="text/javascript" charset="utf-8" 
				src="${facesContext.externalContext.requestContextPath}/resources/script/datatable/ZeroClipboard.js"></script>
			<script type="text/javascript" charset="utf-8" 
				src="${facesContext.externalContext.requestContextPath}/resources/script/datatable/TableTools.js"></script>
			
			<script type="text/javascript" charset="utf-8">
			//<![CDATA[
				$(document).ready( function () {
					 var requisitionNo =  $("[id='stock_req_form:requisition_no']").val();
					$("[id='stock_lines_form:requisition_no']").val(requisitionNo);
						
					var oTable = $('#table').dataTable();	
					oTable.$('td').editable( '${facesContext.externalContext.requestContextPath}/resources/script/datatable/editable_ajax.php', {
						"callback": function( sValue, y ) {
							var aPos = oTable.fnGetPosition( this );
							oTable.fnUpdate( sValue, aPos[0], aPos[1] );
							alert(sValue);
						},
						"submitdata": function ( value, settings ) {
							return {
								"row_id": this.parentNode.getAttribute('id'),
								"column": oTable.fnGetPosition( this )[2]
							};
						},
						"height": "14px",
						"width": "100%"
					} );
					
				   
				} );
				    
				
				
				//]]>
			</script>

		</h:head>
		<body>
			
			

			<div id="demo">
				<div>
					<h:inputText id="requisition_no" value="#{stockReqLinesBean.requisitionNo}"></h:inputText>
					
				
				</div>
				<table id="table" class="display">
                	
                    <thead>
						<tr>
							<th>
								requisition No
							</th>
							<th>
								line no
							</th>
							<th>
								item Code
							</th>
							<th>
								price
							</th>
							<th>
								qty
							</th>
						</tr>
					
					</thead>
                     
                     <tbody>
                     	<ui:repeat value="#{stockReqLineService.allStockReqLines}" var="requisitionLine">
                     	<tr>
                     		<td>
								#{requisitionLine.id.requisitionNo}                     		
                     		</td>
                     		<td>
								#{requisitionLine.id.lineNo}                     		
                     		</td>
                     		<td>
								#{requisitionLine.itemCode}                     		
                     		</td>
                     		<td>
								#{requisitionLine.price}                     		
                     		</td>
                     		<td>
								#{requisitionLine.qty}                     		
                     		</td>
                     	
                     	</tr>
                     	</ui:repeat>
                     </tbody>
                    <tfoot>
                   <tr>
							<th>
								requisition No
							</th>
							<th>
								line no
							</th>
							<th>
								item Code
							</th>
							<th>
								price
							</th>
							<th>
								qty
							</th>
						</tr>
					
					</tfoot>
					
				</table>
			
			</div>
			
			
			
		</body>


	</h:form>
</f:view>
</html>
